package com.dream.logger

import io.github.aakira.napier.DebugAntilog
import io.github.aakira.napier.Napier

interface Logger {
    fun v(msg: String)
    fun d(msg: String)
    fun e(message: String, throwable: Throwable? = null, tag: String? = null)
}

object Log : Logger {

    init {
        Napier.base(DebugAntilog("lanlan"))
    }

    var needLog = true
    fun openLog(needLog: Boolean) {
        this.needLog = needLog
    }

    override fun v(msg: String) {
        if (needLog) {
            Napier.v(msg)
        }

    }

    override fun d(msg: String) {
        if (needLog) {
            Napier.d(msg)
        }
    }

    override fun e(message: String, throwable: Throwable?, tag: String?) {
        Napier.e(message, throwable, tag)
    }
}